package squareBorderPackage;

import java.util.*;
/**
 * An interface introducing methods for teleportation facilities for squares.
 * 
 * @version	1.0
 * @author 	Jessa Bekker && Esther Alberts
 */
public interface Teleportation{

	/**
	 * Check whether the given square is direct accessible by teleportation.
	 * 
	 * @param 	other
	 * 			The square to check the accessibility by teleportation for.
	 * @pre		the given square must be effective
	 * 			| other != null
	 */
    public abstract boolean isTeleSquare(Square other);
    
    /**
     * Return the squares to which can be teleported from this square.
     */
    public abstract HashSet<AccessibleSquare> getTeleSquares();
    
    /**
     * Return a square of the connected squares or the given square.
     * 
     * @pre		the given square must be effective
     * 			| square != null
     * @return	A random generated square of the connected squares and the given square.
     * 			| take i = random.nextInt(getConnectedSquares().size())
     * 			| if (i == getConnectedSquares().size())
     * 			|	then (result == square)
     * 			| else
     * 			|	result == getConnectedSquares().toArray()[i]
     */
    public abstract Square getRandomNextSquare(Square square);
    
    /**
     * random generator
     */
    public static final Random random = new Random();
    
    /**
	 * Check whether the given list of Telesquares is a valid set of squares to teleport to
	 * 	 for this teleportation square.
	 * 
	 * @param	telesquares
	 * 			the list of telesquares to be checked
	 * @return	False if the given telesquares are invalid
	 * 			| if(telesquares ==0)
	 * 			|	then (result == false)
	 * 			Otherwise, true if and only if there is no null-reference in the list of telesquares.
	 * 			| for each telesquare in telesquares :
	 * 			|	if(telesquare == null)
	 * 			|		then (result == false)
	 * 			| else
	 * 			|	result == true
	 */
	public abstract boolean areValidTelesquares(HashSet<AccessibleSquare> teleSquares);
    
    /**
	 * Set the connected squares to the given hash set.
     * 
     * @pre		The given hash set must be a valid set of squares to teleport to.
     * 			| areValidTelesquares(squares)
	 */
    public abstract void setTeleSquares(HashSet<AccessibleSquare> squares);
    
    /**
     * Add the given square to the connected squares.
     * 
     * @pre		the given square must be effective.
     * 			| square != null
     * @param 	square
     * 			The square to connect
     */
    public abstract void addTeleSquare(AccessibleSquare square);
    
}